#include<bits/stdc++.h>
using namespace std;
int t,n,m,L,V;
struct car
{
    int d,v,a;
}che[100005];
int chk[100005];
int main()
{
    freopen("detect.in","r",stdin);
    freopen("detect.out","w",stdout);
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        cin>>n>>m>>L>>V;
        for(int j=1;j<=n;j++)
        {
            cin>>che[j].d>>che[j].v>>che[j].a;
        }
        for(int i=1;i<=m;i++)
        {
            cin>>chk[i];
        }
    }
    for(int i=1;i<=t;i++)
    {
        cout<<1<<" "<<1<<endl;
    }
    return 0;
}
